/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utils;

import java.sql.*;

/**
 *
 * @author Julien Cholet & Florence Delbarre
 * 
 */
public class Connexion {
    private String _pilote = "oracle.jdbc.driver.OracleDriver";
    private Connection _connexion;
    private Statement _statement;
    private ResultSet _resultset;

   public Connexion() throws ClassNotFoundException, SQLException {
   
        Class.forName(this._pilote);
	this._connexion = DriverManager.getConnection("jdbc:oracle:thin:@//127.0.0.1:1521/XE","system", "epsi"); //à changer selon l'user
	this._statement = this._connexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
   }
   public Statement getConnexion()
   {
        return this._statement;
   }
   //type select
   public void setQuery(String query) throws SQLException
   {
       this._resultset = this._statement.executeQuery(query);
   }
   //update && insert
   public void setUpdate(String query) throws SQLException
   {
       this._statement.executeUpdate(query);
   }


   public ResultSet getResultSet()
   {
        return this._resultset;
   }

   /*public void closeConnexion() throws SQLException
   {
       this._connexion.close();
       this._statement.close();
   }*/
}
